<html>
<head><meta charset="utf-8"><title>Multiline details assertion · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html">Multiline details assertion</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="222937374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/222937374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#222937374">(Jan 15 2021 at 22:52)</a>:</h4>
<p>I'm experimenting with trait autocompletions on something more or less real and stumbled on lots of assertion failures with itertools:</p>
<div class="codehilite"><pre><span></span><code>[ERROR rust_analyzer] assertion failed at crates/completion/src/item.rs:404:13: multiline detail: fn circular_tuple_windows&lt;T&gt;(self) -&gt; CircularTupleWindows&lt;Self, T&gt;
where Self: Sized + Clone + Iterator&lt;Item = T::Item&gt; + ExactSizeIterator,
              T: tuple_impl::TupleCollect + Clone,
              T::Item: Clone
</code></pre></div>
<p>The assertion is <code>assert_never!(detail.contains('\n'), "multiline detail: {}", detail);</code> (<a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/completion/src/item.rs#L401">here</a>, disregard the line number in the assertion message, it's different due to my changes) and <code>circular_tuple_windows</code> is the <a href="https://github.com/rust-itertools/itertools/blob/573743a097c1701ef3bf8f82a8554a71bfbf0943/src/tuple_impl.rs#L206-L210">itertools function</a></p>
<p>So, should we normalize such details or rather remove the assertion?</p>



<a name="222981612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/222981612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#222981612">(Jan 16 2021 at 13:37)</a>:</h4>
<p>The detail is the thing shown in completion popup next to the item</p>



<a name="222981671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/222981671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#222981671">(Jan 16 2021 at 13:39)</a>:</h4>
<p><a href="/user_uploads/4715/RgvLe4-hzZL5Xw2-a2CTX2Zs/Screenshot_20210116_163807.png">Screenshot_20210116_163807.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/RgvLe4-hzZL5Xw2-a2CTX2Zs/Screenshot_20210116_163807.png" title="Screenshot_20210116_163807.png"><img src="/user_uploads/4715/RgvLe4-hzZL5Xw2-a2CTX2Zs/Screenshot_20210116_163807.png"></a></div>



<a name="222981732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/222981732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#222981732">(Jan 16 2021 at 13:40)</a>:</h4>
<p>The editor shows a silgle line there, so its important that we put something reasonable there</p>



<a name="222981942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/222981942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#222981942">(Jan 16 2021 at 13:45)</a>:</h4>
<p>Looking at the intellij, it makes sense to just put a return type there?</p>
<p><a href="/user_uploads/4715/ESSgWTnxB0YrABxel8dciK3i/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/ESSgWTnxB0YrABxel8dciK3i/image.png" title="image.png"><img src="/user_uploads/4715/ESSgWTnxB0YrABxel8dciK3i/image.png"></a></div>



<a name="222987355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/222987355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#222987355">(Jan 16 2021 at 15:24)</a>:</h4>
<p>In this case, looks like we can discard anything that's after the first <code>\n</code>? Not like we want to display <code>where</code> block there anyway.</p>



<a name="223030770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/223030770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#223030770">(Jan 17 2021 at 08:02)</a>:</h4>
<p>That'd would work as a quick patch, but I'd rather just manually assemble the string to not have <code>\n</code> in the first place</p>



<a name="223032691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/223032691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kirill Bulatov <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#223032691">(Jan 17 2021 at 08:58)</a>:</h4>
<p>Sure, I'll look at it at some point after the trait imports are merged, thank you for guiding.</p>



<a name="223046400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/223046400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#223046400">(Jan 17 2021 at 14:54)</a>:</h4>
<p>Do we want to do this for tonight's release?</p>



<a name="223046785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/223046785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#223046785">(Jan 17 2021 at 15:02)</a>:</h4>
<p>those are just logs <code>assert_always</code>, so this should be fine</p>



<a name="223046795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/223046795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#223046795">(Jan 17 2021 at 15:02)</a>:</h4>
<p>Yeah, but it's pretty spammy</p>



<a name="223047054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/223047054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#223047054">(Jan 17 2021 at 15:09)</a>:</h4>
<p>yeah, we might as well us assert fully...</p>



<a name="223661258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multiline%20details%20assertion/near/223661258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multiline.20details.20assertion.html#223661258">(Jan 22 2021 at 16:06)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/pull/7396">https://github.com/rust-analyzer/rust-analyzer/pull/7396</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>